package com.example.zjx.mvp_logindemo.biz;

import com.example.zjx.mvp_logindemo.bean.User;

/**
 * Created by zjx on 2018
 * information 实现业务登录功能
 */

public class UserLoginBiz implements IUserLoginBiz {

    /**
     * @param username 用户名
     * @param userpasswd 密码
     * @param listener 登录监听
     */
    @Override
    public void login(final String username, final String userpasswd, final OnUserLoginListener listener) {
         new Thread(new Runnable() {
               @Override
               public void run() {
                   try {
                       Thread.sleep(2000);
                      if(username.equals("zhujunxing1996")&&userpasswd.equals("1996814zhu")){
                          User user=new User();
                          user.setUserage("19");
                          user.setUsersex("男");
                          user.setUsername("圆环之理赐予幸福");
                          listener.loginSuccess(user);
                      }else{
                          listener.loginFail();
                      }
                   } catch (InterruptedException e) {
                       e.printStackTrace();
                   }
               }
           }).start();
    }
}
